package main

import (
	"gitee.com/shijun123456/kcgin"
	"gitee.com/shijun123456/kcgin/logs"
	"github.com/shenyisyn/goft-gin/goft"
	"sinery.net.goft/src/configruation"
	"sinery.net.goft/src/controllers"
	"sinery.net.goft/src/fairing"
	"sinery.net.goft/src/middlewares"
)

func main() {
	//注册原生中间件
	//初始化我们的 日志信息
	go func() {
		logs.Info("服务器启动日志")
		logs.Info("当前DevModel : %s", kcgin.KcConfig.RunMode)
		logs.Info("appname: %s", kcgin.AppConfig.String("appname"))
	}()
	goft.Ignite(middlewares.Cors(), middlewares.ErrorFunc()).
		Attach(fairing.NewGoablefairing()).  //注册全局中间件
		Config(configruation.NewDBConfig()). //数据库模型注入 xorm gorm 注入
		Config(configruation.NewModelConfig()).
		Config(configruation.NewServiceConfig()). //注册我们的服务 注入配置 注册dao 注册repo 注册service 注册controler 注册server
		Config(configruation.NewControllerConfig()).
		Mount("v1", controllers.NewCommonController()). //挂载信息
		Config(configruation.NewRouterConfig()).        //注入控制器 注入路由配置
		Launch()
}
